<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('选择题目分类')" />
</head>
<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="category-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>分类名称：</label>
                                <input type="text" name="categoryName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    
    <th:block th:include="include :: footer" />
    
    <script th:inline="javascript">
        var prefix = ctx + "system/question/category";
        
        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "题目分类",
                search: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                clickToSelect: true,
                singleSelect: true,
                columns: [{
                    radio: true
                },
                {
                    field: 'categoryName',
                    title: '分类名称',
                    align: 'center'
                },
                {
                    field: 'parentId',
                    title: '父分类ID',
                    align: 'center'
                },
                {
                    field: 'sort',
                    title: '排序号',
                    align: 'center'
                }]
            };
            $.table.init(options);
        });
        
        // 获取选中的分类数据
        function getSelected() {
            var selected = $("#bootstrap-table").bootstrapTable('getSelections');
            return selected;
        }
    </script>
</body>
</html>